﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using WPFExcelReport.Helpers;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TPGS07
    {

        public TPGS07()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VGSCOLOR();
            DataContext = MV; 
            InitializeComponent(); 
        }

        public override void OnCARTChg()
        {
            base.OnCARTChg();
            if (CART.Length < 33)
                return;
            if (!IsAutoGSC) return;

            if (TBMain.Rows.Count > 0) return;
            dwData = TBMain.NewRow();
            TMV.SetUpNewRow(ref dwData);
            dwData["GSCMANDANT"] = app.Mandant;
            dwData["GSCART"] = Helpers.Helper.Left(CART, 20);
            dwData["GSCVAR"] = CART.Substring(20, 3);
            dwData["GSCFARBE"] = Helper.Right(CART, 10);
            Insert(dwData);
        }
    }
}
